<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>post发送方式</title>
</head>
<body>
	<button id='but'>post发送方式</button>

	<script type="text/javascript">
	var but = document.getElementById('but');

	but.onclick = function()
	{
		//创建ajax对象
		var x = new XMLHttpRequest;


		//绑定事件
		x.onreadystatechange = function()
		{
			if(x.readyState == 4 && x.status == 200){

			
				console.log(x.responseText);
			}
		}
		

		//初始化
		x.open('POST','3.php',true);
		//
		x.setRequestHeader('content-type','application/x-www-form-urlencoded');

		//发送
		x.send();
	}


	</script>
</body>
</html>